#-*- coding:utf-8 -*-
import requests
import PySimpleGUI as sg
import re
import time
import ddddocr as ocr
import urllib.parse
import datetime
import os
import configparser
import math

# 界面框架
def tool_ui(data):
    """
    工具所有的UI布局部分
    :param data: 传入从配置文件tapdconf.ini读取的数据
    :return:布局layout
    """
    """顶部条件输入区域"""
    layout_factor = [
        # 第一行
        [
            sg.Text('* TAPD_Cookie：', size=15, justification='right'),
            sg.Input(key='cookie', size=33, default_text=data['cookie']),
            sg.Button("GET", tooltip='更新项目', size=4, mouseover_colors='#7c8577', use_ttk_buttons=True),
            sg.Text('* 项目：', size=9, justification='right'),
            sg.InputCombo(key='id', size=31, default_value=data['id'], values=data['list_id'].split('_toolflag_'),
                          enable_events=True),
            # values=data['list_id'].split('_toolflag_')
            # sg.Listbox(key='test_list_id',size=(31,10),visible=False,values=data['list_id'].split('_toolflag_'),enable_events=True),
            sg.Text('* 测试开始时间：', size=15, justification='right'),
            sg.Input(key='start_time', size=25, default_text=data['start_time'], tooltip='2021-01-01'),
            sg.CalendarButton('DATE', font=('MS Sans Serif', 2, 'bold'), button_color=('#fffffb', '#11264f'),
                              format='%Y-%m-%d',
                              key='_CALENDAR_', target='start_time', tooltip='选择测试开始时间', title='选择测试开始时间',
                              enable_events=True)
        ],
        # 第二行
        [
            sg.Text('* 邮件服务器地址：', size=15, justification='right'),
            sg.Input(key='smtp_server', size=33, default_text=data['smtp_server'], tooltip='smtp.exmail.qq.com'),
            # sg.Canvas(size=(333, 333), key='canvas',background_color='red'),
            # sg.Combo(key='tooltest1',values=['1','2']),
            sg.Text('* 邮件服务器账号：', size=15, justification='right'),
            sg.Input(key='email_user', size=33, default_text=data['email_user'], tooltip='xxxx@ztccloud.com.cn'),
            sg.Text('* 邮件服务器密码：', size=15, justification='right'),
            sg.Input(key='email_passwd', size=33, password_char='*', default_text=data['email_passwd'])
        ],
        [
            sg.Text('迭代版本：', size=15, justification='right'),
            sg.InputCombo(key='iteration_id', size=31, default_value=data['iteration_id'],
                          values=data['list_iteration'].split('_toolflag_'), enable_events=True),
            sg.Text('缺陷标题：', size=15, justification='right'),
            sg.Input(key='title', size=33, default_text=data['title'], tooltip='根据缺陷标题内容筛选'),
            sg.Text('操作系统：', size=15, justification='right'),
            sg.InputCombo(key='os1', size=31, default_value=data['os1'], values=data['list_os'].split('_toolflag_'),
                          enable_events=True)
        ],
        [
            sg.Text('测试阶段：', size=15, justification='right'),
            sg.InputCombo(key='testphase', size=31, default_value=data['testphase'], tooltip='很多缺陷未填，建议不选',
                          values=data['list_testphase'].split('_toolflag_'), enable_events=True),
            sg.Text('邮件主题：', size=15, justification='right'),
            sg.Input(key='mail_title', size=33, default_text=data['mail_title']),
            sg.Text('是否包节假日：', size=15, justification='right'),
            sg.Radio("是", "RADIO1", key='b2', default=(data['b2'] == 'True')),
            sg.Radio("否", "RADIO1", key='b1', default=(data['b1'] == 'True')),
        ],
        [
            sg.Button("源码", size=10, mouseover_colors='#1d953f', use_ttk_buttons=True),
            sg.Text('  ', size=100, justification='left'),  # 空白区域
            sg.Button("执行", bind_return_key=True, size=10, mouseover_colors='#1d953f', use_ttk_buttons=True),
            sg.Button("清空", size=10, mouseover_colors='#dec674', use_ttk_buttons=True, tooltip='清空执行日志')
            # sg.Exit('退出', s=10)
        ]
    ]
    """邮件正文组成部分输入区域"""
    layout_mail_text = [
        [
            sg.Text('邮件开篇：', size=15, justification='left')
        ],
        [
            sg.Multiline(key='daily_text', size=(75, 6), default_text=data['daily_text'])
        ],
        [
            sg.Text('里程碑总体进度：', size=13, justification='left'),
            sg.Input(key='milestone_address', size=55, default_text=data['milestone_address'], tooltip='里程碑在线文档地址')
        ],
        [
            sg.Multiline(key='milestone_excel', size=(75, 4), tooltip='里程碑在线文档内容，请直接粘贴excel。\n单元格合并格式只会保留第一列。')
            # , default_text=data['milestone_excel'])  # 该字段不做数据恢复了
        ],
        [
            sg.Text('今日测试执行清况：', size=15, justification='left'),
            sg.Input(key='manpower_today', size=3, justification='right', background_color='#009ad6'),
            sg.Text('人天', size=4, justification='left')
        ],
        [
            sg.Multiline(key='test_situation', size=(75, 6), default_text=data['test_situation'])
        ],
        [
            sg.Text('明日计划：', auto_size_text=True, justification='left')
        ],
        [
            sg.Multiline(key='tomorrow_plans', size=(75, 6), default_text=data['tomorrow_plans'])
        ]
    ]
    """工具执行结果展示控件"""
    layout_result = [
        [
            sg.Output(key='debug_result', size=(75, 30))
        ]
    ]
    """总体布局容器"""
    layout = [[
        sg.Frame('', layout_factor)
    ],
        [
            sg.Frame('邮件内容：', layout_mail_text), sg.Frame('执行日志：', layout_result)
        ]

    ]
    return layout

# 获取前1天或N天的日期，beforeOfDay=1：前1天；beforeOfDay=N：前N天
def getdate(beforeOfDay):
    today = datetime.datetime.now()
    # 计算偏移量
    offset = datetime.timedelta(days=-beforeOfDay)
    # 获取想要的日期的时间
    re_date = (today + offset).strftime('%Y-%m-%d')
    return re_date

# 爬数据
def queryDataToEs(pageNum=1,pageSize=1,title='',days=0):
    """
    获取国铁采购平台某天发布的某页的公共id列表和标题列表
    :param pageNum: 查询页码
    :param pageSize: 一页的最大查询数量
    :param title: 筛选条件——标题名称
    :param days:往前查几天。例如0代表查今天，1，代表查昨天
    :return:id, elastic
    """
    # title = urllib.parse.quote(title)
    # print(title)
    url = 'https://cg.95306.cn/proxy/portal/elasticSearch/queryDataToEs'
    headers = {
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
        "Accept-Encoding": "gzip, deflate, br",
        "Accept-Language": "zh-CN,zh;q=0.9",
        "Cache-Control": "no-cache",
        "Connection": "keep-alive",
        "Cookie": "AlteonPcgmh=0a03b7f5f5f0253f1f41",
        "Host": "cg.95306.cn",
        "Pragma": "no-cache",
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": "Windows",
        "Sec-Fetch-Dest": "document",
        "Sec-Fetch-Mode": "navigate",
        "Sec-Fetch-Site": "none",
        "Sec-Fetch-User": "?1",
        "Upgrade-Insecure-Requests": "1",
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36"
    }
    day_num = getdate(days)
    body = {
        "projBidType": "01",
        "bidType": "",
        "noticeType": "",
        "title": title,
        "inforCode": "",
        "startDate": day_num,
        "endDate": day_num,
        "pageNum": pageNum,
        "pageSize": pageSize,
        "projType": "",
        "professionalCode": "",
        "createPeopUnit": ""
    }
    r = requests.get(url=url, headers=headers, params=body)
    r2 = r.json()
    response_code = r2.get("code")
    response = r.text  # 使用replace去除加红标签
    if response_code == "0-0203":  # code=0-0203时需要验证码
        ValidateCode = checkRequestNumValidateCode()
        while not ValidateCode:  # 循环验证，通过为止
            ValidateCode = checkRequestNumValidateCode()
        r = requests.get(url=url, headers=headers, params=body)
        response = r.text  # 重新请求数据
    list_id = re.findall(r"key.:.(.*?)\",", response, re.S)  # 正则匹配id
    id = list_id[0]
    elastic = elasticSearch(id)

    return id, elastic  # , list_Title

# 分页查询爬所有数据，每次只查一条
def queryDataToEs_bypage(pageSize=1,title='',days=0):
    # list_id, list_elastic  # id列表和对应的正文列表
    url = 'https://cg.95306.cn/proxy/portal/elasticSearch/queryDataToEs'
    headers = {
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
        "Accept-Encoding": "gzip, deflate, br",
        "Accept-Language": "zh-CN,zh;q=0.9",
        "Cache-Control": "no-cache",
        "Connection": "keep-alive",
        "Cookie": "AlteonPcgmh=0a03b7f5f5f0253f1f41",
        "Host": "cg.95306.cn",
        "Pragma": "no-cache",
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": "Windows",
        "Sec-Fetch-Dest": "document",
        "Sec-Fetch-Mode": "navigate",
        "Sec-Fetch-Site": "none",
        "Sec-Fetch-User": "?1",
        "Upgrade-Insecure-Requests": "1",
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36"
    }
    day_num = getdate(days)
    body = {
        "projBidType": "01",
        "bidType": "",
        "noticeType": "",
        "title": title,
        "inforCode": "",
        "startDate": day_num,
        "endDate": day_num,
        "pageNum": "1",
        "pageSize": '500',  # pageSize,
        "projType": "",
        "professionalCode": "",
        "createPeopUnit": ""
    }
    r = requests.get(url=url, headers=headers, params=body)
    r2 = r.json()
    response_totalCount = r2.get("data").get("resultData").get("totalCount")  # 需比总数多一个
    # if pageSize > 10:
    #     req_num = math.ceil(int(response_totalCount) / 10)  # 需要请求次数
    # else:
    #     req_num = math.ceil(int(response_totalCount) / pageSize)  # 需要请求次数
    print("总数，页数>>>", response_totalCount)
    list_id = []
    list_elastic = []
    for i in range(1, response_totalCount):
        list_data_tmp = queryDataToEs(pageNum=i, pageSize=pageSize, title=title, days=days)  # 获取一条id，和它对应的正文：元组
        list_id.append(list_data_tmp[0])
        list_elastic.append(list_data_tmp[1])
    return list_id, list_elastic  # id列表和对应的正文列表


# 爬正文
def elasticSearch(id):
    """
    根据公告id查询出公告内容
    :param id: 公告id
    :return: 公告内容
    """
    url = 'https://cg.95306.cn/proxy/portal/elasticSearch/indexView'
    headers = {
        "Accept":"application/json, text/javascript, */*; q=0.01",
        "Accept-Encoding":"gzip, deflate, br",
        "Accept-Language":"zh-CN,zh;q=0.9",
        "Connection":"keep-alive",
        "Cookie":"AlteonPcgmh=0a03b7fa1ee41afd1f41; cgptmhCookie=mh_7cae3qdir5kl5xy4kb6mspcvhjbohgcakkf5",
        "Host":"cg.95306.cn",
        "Referer":"https://cg.95306.cn/baseinfor/notice/informationShow?id=c1230b27282af62f5262e2308f5bfd72",
        "User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36",
        "X-Requested-With":"XMLHttpRequest"
    }
    body = {
        "noticeId": id
    }
    r = requests.get(url=url, headers=headers, params=body)
    r2 = r.json()
    response_code = r2.get("code")
    elastic = r.text
    if response_code == "0-0203":  # code=0-0203时需要验证码
        ValidateCode = checkRequestNumValidateCode()
        while not ValidateCode:  # 循环验证，通过为止
            ValidateCode = checkRequestNumValidateCode()
        r = requests.get(url=url, headers=headers, params=body)
        elastic = r.text  # 重新请求数据
    # print("公告正文>>>", elastic)
    return elastic

# 验证码
def checkRequestNumValidateCode():
    """验证码，成功率非100"""
    t = int(time.time() * 1000)
    data = {
        "validCodeKey": t,
        "timestamp": t
    }
    c = requests.get("https://cg.95306.cn/proxy/portal/enterprise/base/loadComplexValidCodeImg", params=data)
    with open("./ValidateCode.png", "wb") as f:
        f.write(c.content)  # 得到验证码图片，保存成png图片文件

    f = open(r"./ValidateCode.png", "rb")
    content = f.read()
    f.close()
    num_Ocr = ocr.DdddOcr().classification(content)  # 识别出来的验证码
    # print("num_Ocr>>>", num_Ocr)
    headers = {
        "Accept": "application/json, text/javascript, */*; q=0.01",
        "Accept-Encoding": "gzip, deflate, br",
        "Accept-Language": "zh-CN,zh;q=0.9",
        "Connection": "keep-alive",
        "Content-Length": "43",
        "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
        "Cookie": "cgptmhCookie=mh_7cae3qdir5kl5xy4kb6mspcvhjbohgcakkf5; AlteonPcgmh=0a03b7f50bc7ec3d1f41",
        "Host": "cg.95306.cn",
        "Origin": "https://cg.95306.cn",
        "Referer": "https://cg.95306.cn/baseinfor/notice/toBuyNoticeMore?bidType=01&noticeType=01&transactionType=01&navigation=c&wzType=&title=",
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36",
        "X-Requested-With": "XMLHttpRequest"
    }
    data_ValidateCode = {
        "picValidCodeKey": t,
        "picValidCode": num_Ocr
    }
        # "picValidCodeKey=" + t + "&picValidCode=" + num_Ocr

    # print("时间", t)

    RequestNum = requests.post("https://cg.95306.cn/proxy/portal/elasticSearch/checkRequestNumValidateCode",  headers=headers, data=data_ValidateCode)
    # print("RequestNum", RequestNum.text)
    RequestNum = RequestNum.json().get("success")
    # print("RequestNum.success>>>", RequestNum)
    if RequestNum:
        # print("验证通过")
        return True  # 验证通过
    else:
        # print("验证不通过")
        return False  # 验证不通过

def search_result(a1, a2):
    """
    列表元素过滤器
    :param a1: 原列表
    :param a2: 过滤字段
    :return: 过滤后的列表
    """
    return list((filter(lambda seq: re.search(a2, seq) is not None, a1)))


day_0 = datetime.datetime.today().strftime('%Y-%m-%d')  # 获取今日日期:str
day_1 = getdate(1)  # 获取做日日期:str
day_2 = getdate(2)  # 获取前日日期:str
list_sections_today = [day_0, day_1, day_2]
# 读配置文件
def read_conf(path, path_pic):
    """
    读配置文件
    :param path: 配置文件路径
    :return: data
    """

    if not os.path.exists(path):  # 判断文件是否存在
        if not os.path.exists(path_pic):  # 判断文件夹是否存在
            os.makedirs(path_pic)
        tapdconf_reset(path)  # 重置配置文件
    else:
        with open(path, 'r') as f:
            conf_text = f.read()
        if len(conf_text.strip()) > 0:  # 判断是否空文件
            print("非空文件")
            config.read(path)
            list_sections = config.sections()
            print("配置文件有这几天的数据>>>", list_sections)
            num_search = 0  # 从当天开始算，查几天的数据，默认0不查
            if day_2 not in list_sections:
                print("更新配置文件,执行三天的id和正文查询")
                num_search = 3
                pass  # 更新配置文件,执行三天的id和正文查询
            elif day_1 not in list_sections:
                print("更新配置文件,执行两天的id和正文查询")
                num_search = 2
                pass  # 更新配置文件,执行两天的id和正文查询
            elif day_0 not in list_sections:
                num_search = 1
                print("更新配置文件,执行今天的id和正文查询")
                pass  # 更新配置文件,执行今天的id和正文查询
            # 执行开始
            if num_search > 0:
                print("num_search>>>", num_search)
                for i in range(0, num_search):
                    id_list, list_elastic = queryDataToEs_bypage(pageSize=1, title='', days=i)
                    day_num = getdate(i)
                    write_conf_oneday(day_num, id_list, list_elastic)

            for i in list_sections:
                if i not in list_sections_today:  # 如果不是近三天的数据
                    print("如果不是近三天的数据,则删除这个日期下的数据")
                    pass  # 则删除这个日期下的数据
        else:
            print("空文件")
            tapdconf_reset(path)  # 重置配置文件

    """确保数据完整了，就开始读"""
    with open(path, 'r') as f:
        print("确保数据完整了，就开始读")
        config.read(f)
        data = {}  # 列表
        for i in list_sections_today:
            tmp = config.items(i)  # 列表元组
            print(tmp)
            for k, v in tmp:
                data[k] = v
        # print("data>>>", data)
        return data  # 返回三天的数据，顺便按照id去了重
# 重置配置文件
def tapdconf_reset(path):
    """如果配置文件被改,调此方法直接重置配置文件"""
    print("重置配置文件")
    config[list_sections_today[2]] = {
    }
    config[list_sections_today[1]] = {
    }
    config[list_sections_today[0]] = {
    }
    with open(path, 'w') as f:
        config.write(f)

def key_value(id_list, list_elastic):
    str = '{'
    for key,value in enumerate(id_list):
        str = str + '"' + value + '":"' + list_elastic[key].replace('"', "'").replace('%', "") + '"' + ','
    return str[:-1]+"}"

def write_conf_oneday(section, id_list, list_elastic):
    """往配置文件写入一天数据"""
    print("往配置文件写入这天的数据:", section)
    str = eval(key_value(id_list, list_elastic))
    config[section] = str
#     config[section] = {'662b85c391d810a295f197d1a3f220a9': "{'code':null,'success':true,'msg':'操作成功','data':{'noticeContent':{'id':'662b85c391d810a295f197d1a3f220a9','key':'662b85c391d810a295f197d1a3f220a9','notTitle':'【武汉局集团公司】宜昌综合维修段2021年焦柳线枝江站23条附带曲线清筛大修项目中标候选人公示','notCont':'<div class='WordSection1' style='layout-grid: 15.6pt;'><div class='WordSection1' style='layout-grid: 15.6pt;'><p style='margin: 0cm 0cm 12pt; text-indent: 24pt; line-height: 28pt; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman', serif;'><span style='font-size: 14pt; font-family: 宋体; color: black;'>宜昌综合维修段2021年焦柳线枝江站23条附带曲线清筛大修项目（项目编号：WHJ-2021-0978）评审工作已完成，现将中标候选人公示如下：</span></p><div align='center'><table class='MsoNormalTable' style='width: 100.0; border-collapse: collapse; border: none;' border='1' width='100' cellspacing='0' cellpadding='0'><tbody><tr style='height: 24.1pt;'><td style='width: 18.72; border: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; height: 24.1pt;' width='18'><p style='text-align: center; margin: 0cm 0cm 0.0001pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='center'><span style='font-family: 宋体; color: black; font-size: 14pt;'>包件号</span></p></td><td style='width: 24.22; border: solid windowtext 1.0pt; border-left: none; padding: 0cm 5.4pt 0cm 5.4pt; height: 24.1pt;' width='24'><p style='text-align: center; margin: 0cm 0cm 0.0001pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='center'><span style='font-family: 宋体; color: black; font-size: 14pt;'>包件名称</span></p></td><td style='width: 39.88; border: solid windowtext 1.0pt; border-left: none; padding: 0cm 5.4pt 0cm 5.4pt; height: 24.1pt;' width='39'><p style='text-align: center; margin: 0cm 0cm 0.0001pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='center'><span style='font-family: 宋体; color: black; font-size: 14pt;'>中标候选人</span></p></td><td style='width: 17.2; border: solid windowtext 1.0pt; border-left: none; padding: 0cm 5.4pt 0cm 5.4pt; height: 24.1pt;' width='17'><p style='text-align: center; margin: 0cm 0cm 0.0001pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='center'><span style='font-family: 宋体; color: black; font-size: 14pt;'>推荐顺序</span></p></td></tr><tr style='height: 24.1pt;'><td style='width: 18.72; border: solid windowtext 1.0pt; border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; height: 24.1pt;' width='18'><p style='text-align: center; margin: 0cm 0cm 0.0001pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='center'><span style='font-family: 宋体; color: black; font-size: 14pt;'>BJ-0001</span></p></td><td style='width: 24.22; border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; height: 24.1pt;' width='24'><p style='text-align: center; margin: 0cm 0cm 0.0001pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='center'><span style='font-family: 宋体; font-size: 14pt;'>附带曲线清筛大修</span></p></td><td style='width: 39.88; border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; height: 24.1pt;' width='39'><p style='text-align: center; margin: 0cm 0cm 0.0001pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='center'><span style='font-family: 宋体; font-size: 14pt;'>枝江市嵩盛建设工程有限责任公司</span></p></td><td style='width: 17.2; border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; height: 24.1pt;' width='17'><p style='text-align: center; margin: 0cm 0cm 0.0001pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='center'><span style='font-family: 宋体; color: black; font-size: 14pt;'>1</span></p></td></tr><tr style='height: 24.1pt;'><td style='width: 18.72; border: solid windowtext 1.0pt; border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; height: 24.1pt;' width='18'><p style='text-align: center; margin: 0cm 0cm 0.0001pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='center'><span style='font-family: 宋体; color: black; font-size: 14pt;'>BJ-0001</span></p></td><td style='width: 24.22; border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; height: 24.1pt;' width='24'><p style='text-align: center; margin: 0cm 0cm 0.0001pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='center'><span style='font-family: 宋体; font-size: 14pt;'>附带曲线清筛大修</span></p></td><td style='width: 39.88; border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; height: 24.1pt;' width='39'><p style='text-align: center; margin: 0cm 0cm 0.0001pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='center'><span style='font-family: 宋体; font-size: 14pt;'>襄阳明强土石方工程有限公司</span></p></td><td style='width: 17.2; border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; height: 24.1pt;' width='17'><p style='text-align: center; margin: 0cm 0cm 0.0001pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='center'><span style='font-family: 宋体; color: black; font-size: 14pt;'>2</span></p></td></tr><tr style='height: 24.1pt;'><td style='width: 18.72; border: solid windowtext 1.0pt; border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; height: 24.1pt;' width='18'><p style='text-align: center; margin: 0cm 0cm 0.0001pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='center'><span style='font-family: 宋体; color: black; font-size: 14pt;'>BJ-0001</span></p></td><td style='width: 24.22; border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; height: 24.1pt;' width='24'><p style='text-align: center; margin: 0cm 0cm 0.0001pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='center'><span style='font-family: 宋体; font-size: 14pt;'>附带曲线清筛大修</span></p></td><td style='width: 39.88; border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; height: 24.1pt;' width='39'><p style='text-align: center; margin: 0cm 0cm 0.0001pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='center'><span style='font-family: 宋体; font-size: 14pt;'>武汉市双辉鼎盛建筑工程有限公司</span></p></td><td style='width: 17.2; border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; height: 24.1pt;' width='17'><p style='text-align: center; margin: 0cm 0cm 0.0001pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='center'><span style='font-family: 宋体; color: black; font-size: 14pt;'>3</span></p></td></tr></tbody></table></div><p style='margin: 12pt 0cm 0.0001pt; text-indent: 24pt; line-height: 28pt; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman', serif;'><span style='font-size: 14pt; font-family: 宋体; color: black;'>公示时间：2021年9月17日</span></p><p style='text-indent: 24pt; line-height: 28pt; margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman', serif;'><span style='font-size: 14pt; font-family: 宋体; color: black;'>投标人和其他利害关系人对公示结果如有异议,应当在2021年9月22日17:00（北京时间）前以书面形式向异议受理部门提出，逾期不再受理。</span></p><p style='text-indent: 24pt; line-height: 28pt; margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman', serif;'><span style='font-size: 14pt; font-family: 宋体; color: black;'>异议受理部门：中国铁路武汉局集团有限公司物资部</span></p><p style='text-indent: 24pt; line-height: 28pt; margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman', serif;'><span style='font-size: 14pt; font-family: 宋体; color: black;'>通信地址：武汉市武昌区八一路2号南一楼414室</span></p><p style='text-indent: 24pt; line-height: 28pt; margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman', serif;'><span style='font-size: 14pt; font-family: 宋体; color: black;'>电话（传真）：027-51125128、027-51169203</span></p><p style='text-indent: 24pt; line-height: 28pt; margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman', serif;'><span style='font-size: 14pt; font-family: 宋体; color: black;'>电子邮箱：whjcgyy@163.com</span></p><p style='text-indent: 24pt; line-height: 28pt; margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman', serif;'><span style='font-size: 14pt; font-family: 宋体; color: black;'>&nbsp;</span></p><p style='text-indent: 24pt; line-height: 28pt; margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman', serif;'><span style='font-size: 14pt; font-family: 宋体; color: black;'>&nbsp;</span></p><p style='text-indent: 24pt; line-height: 28pt; margin: 0cm 0cm 0.0001pt; text-align: justify; font-size: 10.5pt; font-family: 'Times New Roman', serif;'><span style='font-size: 14pt; font-family: 宋体; color: black;'>&nbsp;</span></p><p style='margin: 0cm 2pt 0.0001pt 0cm; text-align: right; line-height: 28pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='right'><span style='font-size: 14pt; font-family: 宋体; color: black;'>中国铁路武汉局集团有限公司物资设备采购供应所</span></p><p style='margin: 0cm 68pt 0.0001pt 0cm; text-align: right; line-height: 28pt; font-size: 10.5pt; font-family: 'Times New Roman', serif;' align='right'><span style='font-size: 14pt;'><span style='font-family: 宋体; color: black;'>2021</span><span style='font-family: 宋体; color: black;'>年9月17日</span></span></p></div></div>','inforCode':'总39QUATDW','createPeopUnit':'2b57eaae-21c2-4bbd-afe7-797020822b07','checkTime':'2021-09-17 19:29:19','projCode':null,'biddingProjCode':'WHJ-2021-0978','sourceId':'05'},'relateNoticeList':[{'id':'beffc69026bf80ef1b0d3ce356e7efa0','key':'beffc69026bf80ef1b0d3ce356e7efa0','noticeTypeName':'项目公告','notTitle':'【武汉局集团公司】宜昌综合维修段2021年焦柳线枝江站23条附带曲线清筛大修项目招标公告','checkTime':'2021-08-31 18:26:56'}],'forwardTips':'无'},'sysTime':1631878713438}",
# '00f4f946bc34b53b775ce28a36e0934a': "{'code':null,'success':true,'msg':'操作成功','data':{'noticeContent':{'id':'00f4f946bc34b53b775ce28a36e0934a','key':'00f4f946bc34b53b775ce28a36e0934a','notTitle':'大西高铁桥下防护栅栏工程（第三期）监理比选采购公告','notCont':'<p style='text-align: center; line-height: 18pt; margin: 0pt 0pt 0.0001pt; font-family: 'Times New Roman'; font-size: 10.5pt;' align='center'><a name='_Toc6141'></a><strong><span style='font-family: 黑体; font-size: 14.0000pt;'><a name='_Toc8863'></a></span></strong></p><p style='text-align: center; line-height: 18pt; margin: 0pt 0pt 0.0001pt; font-family: 'Times New Roman'; font-size: 10.5pt;' align='center'><strong><span style='font-family: 黑体; font-size: 14.0000pt;'><span style='font-family: 黑体;'>大西高铁桥下防护栅栏工程（第三期）监理</span></span></strong></p><p style='text-align: center; line-height: 18pt; margin: 0pt 0pt 0.0001pt; font-family: 'Times New Roman'; font-size: 10.5pt;' align='center'><strong><span style='font-family: 黑体; font-size: 14.0000pt;'><span style='font-family: 黑体;'>比选公告</span></span></strong></p><p style='margin: 4.65pt 0pt 0.0001pt; text-indent: 23.5pt; text-align: center; line-height: 18pt; font-family: 'Times New Roman'; font-size: 10.5pt;' align='center'><a name='_Toc31216'></a><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>项目编号：</span><span style='font-family: 宋体;'>LZBX2021-03</span></span></p><p style='margin: 4.65pt 0pt 0.0001pt; text-indent: 23.6pt; line-height: 18pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><strong><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>1.比选条件</span></span></strong></p><p style='text-indent: 24pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>本项目大西高铁桥下防护栅栏工程（第三期）监理，已由《中国铁路太原局集团有限公司关于大西高铁桥下防护栅栏工程（第三期）可行性研究报告的批复》（太铁计函〔</span>2021〕92号）、《中国铁路太原局集团有限公司关于大西高铁桥下防护栅栏工程（第三期）施工图设计审查意见的函》（太铁科信函〔2021〕405号）、《2021 年第六次调整计划（大西公司技术改造）》（太铁计〔2021〕2001号附件2-3）文件批准建设。项目业主为大西铁路客运专线有限责任公司，比选人为大秦铁路股份有限公司临汾地区工程建设指挥部。建设资金来源为大西客专公司技术改造资金，已落实。本项目监理已具备比选监理单位条件，现进行公开比选监理单位。</span></p><p style='margin: 4.65pt 0pt 0.0001pt; text-indent: 23.6pt; line-height: 18pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><a name='_Toc19114'></a><strong><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>2.项目概况与比选范围</span></span></strong></p><p style='text-indent: 24pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><a name='_Toc313861720'></a><span style='font-family: 宋体; font-size: 12.0000pt;'><a name='_Toc434451512'></a><a name='_Toc453372738'></a><a name='_Toc434481108'></a><a name='_Toc452574257'></a><span style='font-family: 宋体;'>2.1项目概况：大西高铁魏家庄跨大运高速公路特大桥、梅家庄跨大运高速公路特大桥等79座桥下安设防护栅栏，累计长度193.2公里。</span></span></p><p style='text-indent: 24pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>2.2标段划分：本次比选划分为1个标段。</span></span></p><p style='text-indent: 24pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>2.3计划工期：8个月。</span></span></p><p style='margin: 4.65pt 0pt 0.0001pt; text-indent: 23.6pt; line-height: 18pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><a name='_Toc815'></a><strong><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>3.比选申请人资格要求</span></span></strong></p><p style='margin: 4.65pt 0pt 0.0001pt; text-indent: 23.5pt; line-height: 18pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><a name='_Toc238797535'></a><span style='font-family: 宋体; font-size: 12.0000pt;'><a name='_Toc243475753'></a><a name='_Toc238552180'></a><a name='_Toc313861721'></a><a name='_Toc17123'></a><a name='_Toc152042291'></a><a name='_Toc152045515'></a><a name='_Toc144974483'></a><span style='font-family: 宋体;'>3.1参选人须具有独立法人资格，有良好的企业社会信誉，在人员、设备、资金等方面具有相应的监理能力</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>。</span></span></p><p style='margin: 4.65pt 0pt 0.0001pt; text-indent: 23.5pt; line-height: 18pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>3.2</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>遵守国家法律、行政法规，具有良好的信誉、具有履行合同的能力和良好的履约记录。</span></span></p><p style='margin: 4.65pt 0pt 0.0001pt; text-indent: 23.5pt; line-height: 18pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>3.3参选人须具备铁路工程监理乙级及以上资质，有效的营业执照。</span></span></p><p style='margin: 4.65pt 0pt 0.0001pt; text-indent: 23.5pt; line-height: 18pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>3.4具有认证机构认证的质量管理体系证书</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>。</span></span></p><p style='margin: 4.65pt 0pt 0.0001pt; text-indent: 23.5pt; line-height: 18pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>3.5总监理工程师须具有大专及以上学历，依法在本单位注册的注册监理工程师，且经过总监理工程师岗前培训并取得培训合格证书。5年及以上铁路工程监理经历，在本监理单位服务2年以上、劳动合同终止期不早于本工程监理合同终止期，具有较高的技术水平和较强的组织管理能力。</span></span></p><p style='margin: 4.65pt 0pt 0.0001pt; text-indent: 23.5pt; line-height: 18pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>3.6参选人</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>近三年内具备同类工程及铁路营业线</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>监理</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>业绩，无被责令暂停投标情况。</span></span></p><p style='margin: 4.65pt 0pt 0.0001pt; text-indent: 23.5pt; line-height: 18pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>3.7</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>不接受联合体参选。</span></span></p><p style='margin: 4.65pt 0pt 0.0001pt; text-indent: 23.6pt; line-height: 18pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><strong><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>4.比选文件的获取</span></span></strong></p><p style='text-indent: 24pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><a name='_Toc243475754'></a><span style='font-family: 宋体; font-size: 12.0000pt;'><a name='_Toc152045516'></a><a name='_Toc238797536'></a><a name='_Toc144974484'></a><a name='_Toc238552181'></a><a name='_Toc152042292'></a><a name='_Toc314250241'></a><a name='_Toc152042293'></a><a name='_Toc238552183'></a><a name='_Toc144974485'></a><a name='_Toc238797538'></a><a name='_Toc313861724'></a><a name='_Toc152045517'></a><a name='_Toc243475756'></a><span style='font-family: 宋体;'>请于</span>2021年</span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>9</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>月</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>18</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>日至</span>2021年</span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>9</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>月</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>23</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>日，每日上午</span>8：30时至11：30时，下午14：30时至17：30时（北京时间，下同，国家法定节假日休息），持单位介绍信，在山西省太原市杏花岭区肖墙路御花园假日广场B座923领取比选文件，恕不邮购。</span></p><p style='margin: 4.65pt 0pt 0.0001pt; text-indent: 23.6pt; line-height: 18pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><a name='_Toc5748'></a><strong><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>5.比选申请文件的递交</span></span></strong></p><p style='text-indent: 24pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><a name='_Toc243475755'></a><a name='_Toc314250242'></a><a name='_Toc157499355'></a><a name='_Toc238797537'></a><span style='font-family: 宋体;'>5.1 比选申请文件递交的时间为：2021年</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>9</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>月</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>30</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>日</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>9</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>时</span>00分至</span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>9</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>时</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>30</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>分，递交比选申请文件的截止时间为</span>2021年</span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>9</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>月</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>30</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>日</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>9</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>时</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>30</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>分，地点为中经国际招标集团山西有限公司（山</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>西省太原市杏花岭区肖墙路御花园假日广场</span>B座919室）。届时，请比选申请人法定代表人或其委托代理人持有效证件在比选时签到参加。</span></p><p style='text-indent: 24.2pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>5.2 逾期送达的或者未送达指定地点的或者不按照比选文件要求密封的比选申请文件，比选人不予受理。</span></span></p><p style='text-indent: 24.2pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>5.3本次询比的开标时间为2021年9月30日9时30分，地点为山西省太原市杏花岭区肖墙路御花园假日广场B座919室。</span></span></p><p style='text-indent: 23.6pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><a name='_Toc14440'></a><strong><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>6.发布公告的媒介</span></span></strong></p><p style='text-indent: 24.2pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><a name='_Toc16004'></a><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>本次比选公告同时在《国铁采购平台》和《山西省招标投标公共服务平台》上发布。</span></span></p><p style='text-indent: 23.6pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><strong><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>7.联系方式</span></span></strong></p><p style='text-indent: 24.2pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>招</span> 标 </span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>人：</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>大秦铁路股份有限公司临汾地区工程建设指挥部</span></span></p><p style='text-indent: 24.2pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>地</span> &nbsp;&nbsp;&nbsp;址：山西省临汾市尧都区平阳北街520号 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p><p style='text-indent: 24.2pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>联</span> 系 人：丁先生</span></p><p style='text-indent: 24.2pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>电</span> &nbsp;&nbsp;&nbsp;话：18135185376</span></p><p style='text-indent: 24.2pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>电子邮件：</span>lzgcba@126.com</span></p><p style='text-indent: 24.2pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'>&nbsp;</span></p><p style='text-indent: 24.2pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'>&nbsp;</span></p><p style='text-indent: 24.2pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>招标代理机构：中经国际招标集团山西有限公司</span></span></p><p style='text-indent: 24.2pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>地址：山西省太原市杏花岭区肖墙路</span>9号御花园假日广场B座92</span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>3</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>号</span></span></p><p style='text-indent: 24.2pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>联系人：陈</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>女士</span></span></p><p style='text-indent: 24.2pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>联系电话：</span>13803400701</span></p><p style='text-indent: 24.2pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>电子邮件：</span></span><a href='mailto:zjgjzb006@126.com'><u><span class='15' style='font-family: 宋体; color: #0000ff; text-decoration: underline; font-size: 12.0000pt;'>zjgjzb006@126.com</span></u></a></p><h2 style='margin-top: 36pt; margin-bottom: 12pt; break-after: avoid; text-align: center; line-height: 150; font-family: Arial; font-size: 22pt;'><span style='font-family: Arial; font-size: 22.0000pt;'>&nbsp;</span></h2><p style='text-indent: 21pt; word-break: break-all; text-align: right; line-height: 150; margin: 0pt 0pt 0.0001pt; font-family: 'Times New Roman'; font-size: 10.5pt;' align='right'><span style='font-family: 宋体; font-size: 10.5000pt;'>&nbsp;</span></p><p style='text-indent: 24.2pt; text-align: right; line-height: 18pt; margin: 0pt 0pt 0.0001pt; font-family: 'Times New Roman'; font-size: 10.5pt;' align='right'><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>招</span> 标 </span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>人</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>：大秦铁路股份有限公司临汾地区工程建设指挥部</span></span></p><p style='text-indent: 24.2pt; text-align: center; line-height: 18pt; margin: 0pt 0pt 0.0001pt; font-family: 'Times New Roman'; font-size: 10.5pt;' align='center'><span style='font-family: 宋体; font-size: 12.0000pt;'>&nbsp;&nbsp;<span style='font-family: 宋体;'>日</span> &nbsp;&nbsp;&nbsp;期：2021年</span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>9</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>月</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>17</span></span><span style='font-family: 宋体; font-size: 12.0000pt;'><span style='font-family: 宋体;'>日</span></span></p><p style='text-indent: 24.2pt; line-height: 18pt; margin: 0pt 0pt 0.0001pt; text-align: justify; font-family: 'Times New Roman'; font-size: 10.5pt;'><span style='font-family: 宋体; font-size: 12.0000pt;'>&nbsp;</span></p>','inforCode':'总39QUAQ6E','createPeopUnit':'5883433f-912c-423d-a47a-cbcf2d3c6b6b','checkTime':'2021-09-17 19:28:31','projCode':null,'biddingProjCode':'LZBX2021-03','sourceId':'05'},'relateNoticeList':[],'forwardTips':'无'},'sysTime':1631878715365}"
# }

    with open(path, 'w') as f:
        config.write(f)

def search_result_top(dict, str):
    list = []
    for k in dict:
        # print(dict[k])
        list.append(dict[k])
    list_2 = search_result(list, str)  # return list
    return list_2

if __name__ == '__main__':
    # a2 = []
    # layout = tool_ui(a2)  # 加载工具的布局
    # window = sg.Window("爬虫工具", layout, finalize=True, enable_close_attempted_event=True)  # 加载布局生成窗口

    """业务参数"""
    elastic_factor = '车辆段委员会三线'  # 筛选条件：正文内容
    # """业务参数"""
    # pageSize = '10'  # 最多请求多少数据
    # title_factor = '接触网'  # 查询条件：标题名称
    # elastic_factor = '广九客运段关于广九客运段宣传品'  # 筛选条件：正文内容
    # search_flag = 'title1'  # 根据标题查询填title，填其他表示直接查正文

    config = configparser.ConfigParser()
    """系统参数"""
    path_hnhh95306 = rf'{os.getenv("APPDATA")}' + '\\hnhh95306' + '\\'  # 应用文件路径
    path = path_hnhh95306 + rf'hnhh95306.ini'  # 配置文件，存储查出来的数据，用于断点查询

    data = read_conf(path, path_hnhh95306)  # 字典
    print("data数据类型和长度", type(data), len(data))

    list_elastic = search_result_top(data, elastic_factor)
    print("list_elastic数据类型和长度", type(list_elastic), len(list_elastic))

    if len(list_elastic):
        list_elastic_result = search_result(list_elastic, elastic_factor)  # 需要的正文列表
        # print("需要的正文列表list_result>>>", list_elastic_result)
        # 从正文列表里查出来id列表
        list_elastic_url = []
        for i in list_elastic_result:
            result_id = re.findall(r"id.:.(.*?).,", i, re.S)  # 正则匹配id
            print("中标的result_id>>>", result_id)
            if len(result_id) > 0:
                for i in result_id:
                    elastic_url = 'https://cg.95306.cn/baseinfor/notice/informationShow?id=' + i
                    list_elastic_url.append(elastic_url)
        print("你所需要的正文的列表uel>>>\n", list_elastic_url)
    else:
        print("程序异常，未能根据id查询到正文，请联系管理员。")

    # """业务参数"""
    # pageSize = '10'  # 最多请求多少数据
    # title_factor = '接触网'  # 查询条件：标题名称
    # elastic_factor = '广九客运段关于广九客运段宣传品'  # 筛选条件：正文内容
    # search_flag = 'title1'  # 根据标题查询填title，填其他表示直接查正文
    #
    # if search_flag == 'title':
    #     data = queryDataToEs(pageSize=pageSize, title_factor=title_factor,days=3)  # data[0]是list_id,data[1]是list_title
    # else:
    #     data = queryDataToEs(pageSize=pageSize,days=3)
    #
    # list_elastic = []  # 存储正文
    # if len(data[0]) == 0:
    #     print("未查询到数据")
    #     # return
    # for id in data[0]:
    #     elastic = elasticSearch(id)
    #     if elastic:
    #         list_elastic.append(elastic)  # 存储id对应的正文
    #
    # if len(list_elastic):  # 查到正文了
    #     # print(len(list_elastic))
    #     list_elastic_result = search_result(list_elastic, elastic_factor)  # 需要的正文列表
    #     # print("需要的正文列表list_result>>>", list_elastic_result)
    #     # 从正文列表里查出来id列表
    #     list_elastic_url = []
    #     for i in list_elastic_result:
    #         result_id = re.findall(r"id.:.(.*?)\",", i, re.S)  # 正则匹配id
    #         if len(result_id)>0:
    #             for i in result_id:
    #                 elastic_url = 'https://cg.95306.cn/baseinfor/notice/informationShow?id=' + i
    #                 list_elastic_url.append(elastic_url)
    #     print("你所需要的正文的列表>>>\n", list_elastic_url)
    # else:
    #     print("程序异常，未能根据id查询到正文，请联系管理员。")
    # id = "008dafa0234a6126e91687679793138"  # 2008dafa0234a6126e91687679793138
    # elasticSearch(id)
